﻿@{
    ViewBag.Title = "ObjectProperty";
    Layout = "~/Views/Shared/_Page.cshtml";
}

@Html.Partial("~/Views/Shared/_PageNote.cshtml")

<script type="text/javascript">
    
    window.onload = function() {
        /*
            property check
        */

        var book = {
            "title": "Javascript Definitive Guide",
            "publish date": "2009-05-08",
            author: {
                firstname: "David",
                lastname: "Flanagan"
            }
        };

        ZEUS.DEBUG.log("1. ** property check **");
        var flag;

        flag = false;
        flag = "title" in book;
        ZEUS.DEBUG.log("title in book? " + flag);

        flag = false;
        flag = "publish date" in book;
        ZEUS.DEBUG.log("'publish date' in book? " + flag);

        flag = false;
        flag = "author" in book;
        ZEUS.DEBUG.log("author in book? " + flag);

        ZEUS.DEBUG.log("***********************************");

        flag = false;
        flag = book.hasOwnProperty("title");
        ZEUS.DEBUG.log("book hasOwnProperty title? " + flag);

        flag = false;
        flag = book.hasOwnProperty("publish date");
        ZEUS.DEBUG.log("book hasOwnProperty 'publish date'? " + flag);

        flag = false;
        flag = book.hasOwnProperty("author");
        ZEUS.DEBUG.log("book hasOwnProperty author? " + flag);
        
        ZEUS.DEBUG.log("***********************************");

        for (p in book) {
            ZEUS.DEBUG.log(p.valueOf());
        }


        ZEUS.DEBUG.log("<br />");
    }

</script>

